// extract module
var http = require('http');
var fs = require('fs');
var url = require('url');

// create and run web server
http.createServer(function(request, response) {
	// declare variable
	var pathname = url.parse(request.url).pathname;
	
	// route to page
	if (pathname == '/') {
		// read index.html
		fs.readFile('index.html', function(error, data) {
			// respond
			response.writeHead(200, {'Content-Type': 'text/html'});
			response.end(data);
		});
	}
	else if (pathname == '/other') {
		// read other.html
		fs.readFile('other.html', function(error, data) {
			// respond
			response.writeHead(200, {'Content-Type:': 'text/html'});
			response.end(data);
		});
	}
}).listen(52273, function() {
	console.log('Server running at http://127.0.0.1:52273');
});